const {
  defineConfig
} = require('@vue/cli-service')
const jwt = require('jsonwebtoken');
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false, // 关闭eslint
  runtimeCompiler: true,
  devServer: {
    onBeforeSetupMiddleware({
      app
    }) {
     
      app.get("/api/login", (req, res) => {
        let { username } = req.query
        let token = jwt.sign({
          exp: Math.floor(Date.now() / 1000) + (60 * 60),
          data: username // 用户身份
        }, 'secret');
         console.log(req);
        res.send({
          code: 1,
          token
        })
      })
    }
  }
})